﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Fetion.Core
{
    /// <summary>
    /// 消息描述规范接口
    /// </summary>
    /// <example>扩展一个消息
    /// <code>
    ///    class Register : Fetion.Core.IMessage
    ///    {
    ///        public string Name;
    ///        public string EMail;
    ///        public void Load(Fetion.Core.BufferReader reader)
    ///        {
    ///            Name = reader.ReadString();
    ///            EMail = reader.ReadString();
    ///        }
    ///
    ///        public void Save(Fetion.Core.BufferWriter writer)
    ///        {
    ///            writer.Write(Name);
    ///            writer.Write(EMail);
    ///        }
    ///    }
    ///
    /// </code>
    /// </example>
    public interface IMessage
    {
        /// <summary>
        /// 用于保存消息工作
        /// </summary>
        /// <param name="writer">流写入对象</param>
        void Save(BufferWriter  writer);
        /// <summary>
        /// 用于信息获取
        /// </summary>
        /// <param name="reader">流读取对象</param>
        void Load(BufferReader reader);
        byte[] GetBuffer();
    }

}
